<template>
  <section id="community_home">
  	  <header>
					<div class="input-container">
						<i class="iconfont icon-sousuo"></i>
						<input placeholder="搜索" @keypress="keyPress"/>
					</div>
			</header>
      <tab :tabData="tabData" :menu="false" @add="add">
      	<div slot="tab0">
      		<fork-list></fork-list>
      	</div>
      	<div slot="tab1">
      		<new-list></new-list>
      	</div>
      	<div slot="tab2">
          <car-friend></car-friend>
        </div>
        <div slot="tab3">
          <active-list></active-list>
        </div>
      </tab>
  </section>
</template>
<script>

import tab from 'components/tab/tabs'
import forkList from './forkList'
import newList from './newList'
import carFriend from './carFriendList'
import activeList from './activeList'
export default {
  name:'community_home',
  data(){
      return{
				tabData:[
        {
          title: "关注",
          redMsg: false
        },
        {
          title: "动态",
          redMsg: false
        },
        {
          title: "车友会",
          redMsg: false
        },
        {
          title: "活动",
          redMsg: false
        }
      ],
      obj:'',
      search : ''
      }
  },
  methods: {
      add(){
      	console.log(1)
      },
      keyPress(e){
      	console.log(e.keyCode)
      	let event = e || window.event
      	let target = e.target || e.srcElement
      	if(event.keyCode === 13) {
      		this.search = target.value
      		this.$router.push({
      			name:'search_page',
      			query:{
      				key : this.search
      			}
      		})
      	}
      	console.log(this.search)
      }
  },
  mounted(){
//	getFork.bind(this)({},res=>{
//		this.obj = res
//	})
  },
  components:{
  	tab,carFriend,forkList,newList,activeList
  }
}
</script>
<style>
	header {
		width: 100vw;
		height: 46px;
		display:flex;
		justify-content: center;
		align-items: center;
		padding:0 6px;
	}
	header .input-container {
		width:100%;
		display:flex;
		border-radius: 4px;
		background-color: rgba(0, 0, 0, 0.1);
	}
	header input {
		width:90%;
		border:none;
		background-color: rgba(0, 0, 0, 0);
		outline:none;
	}
	.iconfont.icon-sousuo {
		width:10%;
	}
</style>
